package `object`

/**
 *   @author
 *   @description
 *   @datetime 2021/6/16 13:17
 *
 */
class EnumTest {
}

fun main() {
    Direction.EAST
    println(Direction.NORTH.name)
    // EAST
    println("value of EAST = " + Direction.valueOf("EAST"))

    println(Color.BLUE)
    println(ProtocolState.TALKING)

    println(Color.BLUE.rgb)
    println(Color.BLUE.name)

    println(ColorColor.BLUE.v)

    var colors = Color.values()
    println(colors.toString())

    println(ProtocolState.TALKING)
    println(ProtocolState.TALKING.signal())

    printAllValues<InArithmetics>()
    println(InArithmetics.PLUS.apply(1, 2))
    println(InArithmetics.PLUS.applyAsInt(1, 2))
    // 位置
    println(InArithmetics.TIMES.ordinal)


}

inline fun <reified T : Enum<T>> printAllValues() {
    println(enumValues<T>().joinToString { it.name })
}